diff options
Diffstat (limited to 'src/routes/(app)/fund/[id]/access/+page.server.ts')
| -rw-r--r-- | src/routes/(app)/fund/[id]/access/+page.server.ts | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/routes/(app)/fund/[id]/access/+page.server.ts b/src/routes/(app)/fund/[id]/access/+page.server.ts index 9a8a9dbc..c38cb29b 100644 --- a/src/routes/(app)/fund/[id]/access/+page.server.ts +++ b/src/routes/(app)/fund/[id]/access/+page.server.ts @@ -1,3 +1,25 @@ -export const load = async () => { - return { managers: [] }; +import { auth, fd, get, post } from "$lib/utils"; +import { fail } from "@sveltejs/kit"; + +export const load = async ({ params: { id } }) => { + const managers = await get(`/fund/${id}/managers`); + return { managers, id }; +}; + +export const actions = { + default: async ({ cookies, request }) => { + const form = await fd(request); + + try { + console.log("SUBMITTING", form); + const managers = await post("/fund/managers", form, auth(cookies)); + + console.log(managers); + + return { managers }; + } catch (e) { + const { message } = e as Error; + return fail(400, { message }); + } + }, }; |
